const data = {
  nodes: [{
    id: 'node1',
    "shape": "customNode",
    style: {
        fill: 'red',
        stroke: 'blue'
    },
    label: {
        text: '测试\n测试测试测试测试',
        fill: '#fff'
    },
    x: 50,
    y: 250
  },{
    id: 'node2',
    "shape": "customNode",
    x: 450,
    y: 250
  }],
  edges: [{
    id: 'edge1',
    target: 'node2',
    source: 'node1'
  }]
};
G6.registerNode('customNode', {
  draw(item){
    const group = item.getGraphicGroup();
    const model = item.getModel();
    group.addShape('text', {
      attrs: {
        x: 0,
        y: 0,
        fill: '#f00',
        text: '我是一个自定义节点，\n有下面那个方形和我自己组成'
      }
    });
    group.addShape('text', {
      attrs: {
        x: 0,
        y: 0,
        fill: '#333',
        text: ' ('+model.x+', '+model.y+') \n 原点是组的图坐标',
        textBaseline: 'top'
      }
    });
    group.addShape('circle', {
      attrs: {
        x: 0,
        y: 0,
        r: 4,
        fill: 'blue'
      }
    });
    return group.addShape('rect', {
      attrs: {
        x: 0,
        y: 0,
        width: 100,
        height: 100,
        stroke: 'red'
      }
    });
  }
});
const graph = new G6.Graph({
  container: 'mountNode',
  width: 500,
  height: 500
});
graph.read(data);